
import os
import xlrd

os.environ[ 'DJANGO_SETTINGS_MODULE' ] = 'lads.settings'

from django.db import transaction
from home.models import Lad

wb = xlrd.open_workbook( 'list.xls' )

sheet0 = wb.sheet_by_index( 0 );

lads = sheet0.col_values( colx = 0 );

lads2 = []
for lad in lads:
	lads2.append( lad.strip().replace( '  ', ' ' ) )

db_lads = Lad.objects.filter( track_id = None )



with transaction.commit_on_success():
	for db_lad in db_lads:
		if db_lad.track_id == None:
			if db_lad.name_surname in lads2:
				db_lad.track_id = "denis_b"
				db_lad.save()

